package com.ruoyi.system.wnjk.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.wnjk.domain.po.ShopSubject;
import com.ruoyi.system.wnjk.mapper.ShopSubjectMapper;
import com.ruoyi.system.wnjk.service.IShopSubjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 分类 服务实现类
 * </p>
 *
 * @author chan
 * @since 2025-03-05
 */
@Service
public class ShopSubjectServiceImpl implements IShopSubjectService {
    @Autowired
    private ShopSubjectMapper shopSubjectMapper;

    /**
     * 查询分类
     *
     * @param id 分类主键
     * @return 分类
     */
    @Override
    public ShopSubject selectShopSubjectById(Long id)
    {
        return shopSubjectMapper.selectShopSubjectById(id);
    }

    /**
     * 查询分类列表
     *
     * @param shopSubject 分类
     * @return 分类
     */
    @Override
    public List<ShopSubject> selectShopSubjectList(ShopSubject shopSubject)
    {
        return shopSubjectMapper.selectShopSubjectList(shopSubject);
    }

    /**
     * 新增分类
     *
     * @param shopSubject 分类
     * @return 结果
     */
    @Override
    public int insertShopSubject(ShopSubject shopSubject)
    {
        shopSubject.setCreateTime(DateUtils.getNowDate());
        return shopSubjectMapper.insertShopSubject(shopSubject);
    }

    /**
     * 修改分类
     *
     * @param shopSubject 分类
     * @return 结果
     */
    @Override
    public int updateShopSubject(ShopSubject shopSubject)
    {
        shopSubject.setUpdateTime(DateUtils.getNowDate());
        return shopSubjectMapper.updateShopSubject(shopSubject);
    }

    /**
     * 批量删除分类
     *
     * @param ids 需要删除的分类主键
     * @return 结果
     */
    @Override
    public int deleteShopSubjectByIds(Long[] ids)
    {
        return shopSubjectMapper.deleteShopSubjectByIds(ids);
    }

    /**
     * 删除分类信息
     *
     * @param id 分类主键
     * @return 结果
     */
    @Override
    public int deleteShopSubjectById(Long id)
    {
        return shopSubjectMapper.deleteShopSubjectById(id);
    }
}
